from interface.Memberiniterce1 import MemberInterface
from utile.sendmethod import SendMethod
# 获取收货地址
# 添加收货地址
class DeliveryAddress:
    def __init__(self, url, headers):
        self.url = url
        self.headers = headers

    # 添加收货地址
    def address_add(self, payload):
        method = 'post'
        url = self.url + '/member/address/add'
        return SendMethod.send_method(method=method, url=url, json=payload, headers=self.headers)

    # 获取收货地址
    def address_id(self,payload):
        method='post'
        url = self.url + '/member/address'
        return SendMethod.send_method(method=method, url=url, json=payload, headers=self.headers)


if __name__ == '__main__':
    url = 'http://47.108.206.100:8085'
    headers = MemberInterface(url).get_token('ymYM', 654321)
    DA = DeliveryAddress(url,headers)
    payload ={
            "city": "鄂州",
            "defaultStatus": 0,
            "detailAddress": "玉兰花",
            "id": 0,
            "memberId": 1831,
            "name": "知乐楼",
            "phoneNumber": "18871463422",
            "postCode": "string",
            "province": "string",
            "region": "string"
        }
    print(DA.address_add(payload))
    p= { "id" : 2507}
    print(DA.address_id(p))





